<template>
  <el-card class="filter-card" shadow="hover">
    <el-form :inline="false" size="small" class="flex flex-col gap-3">
      <!-- <el-select v-model="localSortType" placeholder="排序方式" style="width: 100%">
        <el-option label="最新发布" value="time" />
        <el-option label="最多回答" value="answers" />
        <el-option label="最多关注" value="followers" />
      </el-select>
      <el-checkbox v-model="localOnlyUnsolved">只看未解决</el-checkbox> -->
      <el-input v-model="localKeyword" placeholder="关键词搜索" clearable style="width: 100%" />
    </el-form>
    <el-button class="mt-3 w-full" size="small" type="info" @click="resetFilter">重置筛选</el-button>
  </el-card>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
  sortType: String,
  onlyUnsolved: Boolean,
  keyword: String
})
const emit = defineEmits(['update:sortType', 'update:onlyUnsolved', 'update:keyword'])
const localSortType = computed({
  get: () => props.sortType,
  set: v => emit('update:sortType', v)
})
const localOnlyUnsolved = computed({
  get: () => props.onlyUnsolved,
  set: v => emit('update:onlyUnsolved', v)
})
const localKeyword = computed({
  get: () => props.keyword,
  set: v => emit('update:keyword', v)
})
function resetFilter() {
  emit('update:sortType', 'time')
  emit('update:onlyUnsolved', false)
  emit('update:keyword', '')
}
</script>
<style scoped>
.filter-card {
  width: 250px;
  min-width: 200px;
  border-radius: 16px;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.04);
  background: #fff;
  padding: 18px 20px 24px 20px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: none;
}
.el-select {
  --el-select-border-color-hover: #2563eb;
}
.el-input__wrapper {
  border-radius: 8px !important;
}
.el-checkbox {
  margin-left: 2px;
  color: #2563eb;
  font-weight: 500;
}
@media (max-width: 1024px) {
  .filter-card {
    width: 100%;
    min-width: 0;
    margin-bottom: 0;
    padding: 12px 8px 8px 8px;
  }
}
</style> 